import React from 'react';
import classnames from 'classnames';
import './index.less';

export default class view extends React.Component {
    static propTypes = {
        className: React.PropTypes.string,
        label: React.PropTypes.any,
        type: React.PropTypes.string
    };

    static defaultProps = {
        type: 'top'
    }


    constructor(props, context) {

        super(props, context);


        // init state;
        this.state = {
            type: props.type,
            label: props.label
        };
    }
    componentWillMount() {
        this._isMounted = true;

    }

    componentDidMount() {

    }

    componentWillUnmount() {
        this._isMounted = false;
    }

    componentWillReceiveProps({ label }) {
        this.setState({
            label
        })
    }

    render() {
        const classNames = classnames({
            'orin-sw-retips-root': true,
            [this.props.className]: this.props.className ? true : false
        })
        const boxClassNames = classnames({
            'orin-sw-retips-box': true,
            [this.state.type]: true
        })
        return (
            <div className={ classNames } >
                <div className={ boxClassNames }>{ this.state.label}</div>
            </div>
        );
    }
}
